package com.biodiv.community.base;


import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author tianquan
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageResult<T> {

    @Schema(description = "总条数")
    protected Long total;

    @Schema(description = "总页码数")
    protected Long pages;

    @Schema(description = "当前页数据")
    protected List<T> list;

    @JsonIgnore
    public boolean isEmpty(){
        return list == null || list.size() == 0;
    }
}
